﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<jsp:include page="/product/include/base_product_pre_part.jsp"></jsp:include>
<script type="text/javascript">
<!--
function changeCategory(product_id){
	jtool.goto("<%=request.getContextPath()%>/product/editProduct.do?act=cate&id="+product_id);
}
function removeProperty(propertyId,propertyName){
	if(!window.confirm("你确定要删除商品/服务参数["+propertyName+"]吗?"))
		return;
	var link ="<%=request.getContextPath()%>/product/removeProperty.do";
	link+="?propertyId="+propertyId;
	$.ajax(
	{url:link,type:"GET",success:function(msg){
		$("#"+propertyId).remove();
	}
	}
	);
}
function editProperty(productId,propertyId){
	var url ="<%=request.getContextPath()%>/product/editProperty.do";
	url+="?productId="+productId;
	url+="&propertyId="+propertyId;
	jtool.goto(url);
}
//-->
</script>
<table width="100%">
	<s:hidden name="product.id" />
	<s:label name="product.name" label="%{getText('name')}" />
	<tr>
		<td class="tdLabel">
			商品/服务参数:
		</td>
		<td>
			<ul id="propertyBox">
				<s:iterator value="product.properties">
					<li id="<s:property value="id" />">
						<label class="property">
							<s:property value="name" />
						</label>
						&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="javascript:removeProperty('<s:property value="id" />','<s:property value="name" />');">删除</a>
						<a href="javascript:editProperty('<s:property value="product.id" />','<s:property value="id" />');">编辑</a>
						<span style="display: none; background: #f6f6f6;"> <br /> <s:iterator value="values">
								<s:property value="value" />&nbsp;&nbsp;
									</s:iterator> </span>
					</li>
				</s:iterator>
				<script type="text/javascript">
						$(document).ready(function(){
							var properties = $("#propertyBox").find("li");
							$.each(properties,function(){
								var li = $(this);
								var label = li.find("label").css("cursor", "pointer");
								var span = li.find("span").css("cursor", "pointer");
								label.mouseover(function () {span.show(); });
								span.mouseout(function () {span.hide(); });
							});
						});
						</script>
			</ul>
			<a href="<%=request.getContextPath()%>/product/editProperty.do?productId=<s:property value="product.id"/>">添加</a>

		</td>
	</tr>
</table>
<jsp:include page="/product/include/base_product_last_part.jsp"></jsp:include>